export default {
  methods: {
    hasPermissions (permission) {
      if (Array.isArray(permission)) {
        permission.forEach(element => {
          if (this.$route.meta.permissions.includes(element)) {
            return true
          }
        })
        return false
      } else {
        return this.$route.meta.permissions.includes(permission)
      }
    },
    hasRoles (role) {
      if (Array.isArray(role)) {
        role.forEach(element => {
          if (this.$store.state.user.roles.includes(element)) {
            return true
          }
        })
        return false
      } else {
        return this.$store.state.user.roles.includes(role)
      }
    }
  }
}
